Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: fix script check execution #24098

Merged
merged 1 commit into from
Oct 1, 2024
Merged

docker: fix script check execution #24098

merged 1 commit into from
Oct 1, 2024

Conversation

tgross
Copy link
Member

@tgross tgross commented Oct 1, 2024

In #24095 we made a fix for non-streaming exec into Docker tasks for script checks and change_mode = "script", but didn't complete E2E testing. We need to use ContainerExecAttach in the new API in order to get stdout/stderr from tasklets, but the previous ContainerExecStart call will prevent this from running successfully with an error that the exec has already run.

  • Ref: NET-11202 (comment)
  • This has shipped in Nomad 1.9.0-beta.1 but not production yet.
  • This should fix the remaining issues in nightly E2E for Docker.

Note for reviewers: at this point the (*taskHandle).Exec and (*driver).ExecTaskStreaming are similar enough that I suspect we could at least partially merge them, but I'm trying to avoid adding more churn to this code during the beta window. I'd also like to fix this more universally for other driver authors when we tackle NET-11219

E2E run of the currently-failing tests:

$ NOMAD_E2E=1 go test -v -count=1 . -run 'TestE2E/Consul/\*consul\.OnUpdateChecksTest'
=== RUN   TestE2E
=== RUN   TestE2E/Consul
=== RUN   TestE2E/Consul/*consul.OnUpdateChecksTest
=== RUN   TestE2E/Consul/*consul.OnUpdateChecksTest/TestOnUpdateCheck_IgnoreWarning_IgnoreErrors
=== RUN   TestE2E/Consul/*consul.OnUpdateChecksTest/TestOnUpdate_CheckRestart
=== RUN   TestE2E/ConsulNamespaces
--- PASS: TestE2E (105.32s)
    --- PASS: TestE2E/Consul (105.32s)
        --- PASS: TestE2E/Consul/*consul.OnUpdateChecksTest (105.32s)
            --- PASS: TestE2E/Consul/*consul.OnUpdateChecksTest/TestOnUpdateCheck_IgnoreWarning_IgnoreErrors (67.02s)
            --- PASS: TestE2E/Consul/*consul.OnUpdateChecksTest/TestOnUpdate_CheckRestart (38.17s)
    --- PASS: TestE2E/ConsulNamespaces (0.00s)
PASS
ok      github.com/hashicorp/nomad/e2e  105.335s

In #24095 we made a fix for non-streaming exec into Docker tasks for script
checks and `change_mode = "script"`, but didn't complete E2E testing. We need to
use `ContainerExecAttach` in the new API in order to get stdout/stderr from
tasklets, but the previous `ContainerExecStart` call will prevent this from
running successfully with an error that the exec has already run.

* Ref: [NET-11202 (comment)](https://hashicorp.atlassian.net/browse/NET-11202?focusedCommentId=551618)
* This has shipped in Nomad 1.9.0-beta.1 but not production yet.
* This should fix the remaining issues in nightly E2E for Docker.
@@ -48,7 +48,6 @@ job "test" {
on_update = "ignore_warnings"

args = [
"-c",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing the wrong error code because -c means "run this script literal", not "run this script file".

@tgross tgross marked this pull request as ready for review October 1, 2024 19:07
@tgross tgross merged commit e9ba630 into main Oct 1, 2024
32 checks passed
@tgross tgross deleted the e2e-script-checks branch October 1, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants